<%--
  Created by IntelliJ IDEA.
  User: 和盈
  Date: 2021/4/9
  Time: 10:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <script src="../jquery-3.5.1.min.js"></script>
</head>
<body>
<form action="/jsp/upload" method="post" enctype="multipart/form-data">
    <input type="file" name="文件内容">
    <input type="button" id="f" value="上传" onclick="fun()">
</form>
<script>
    function fun() {
            let formData = new FormData();
            let fileValue = document.getElementById("f").files[0];
            formData.append("f",fileValue)
            $.ajax({
                url:"/jsp/upload",
                type:"post",
                data:formData,
                contentType:false,
                processData: false,
                success:function(){
                    alert("上传成功")
                }
            })

    }

</script>


</body>
</html>
